package com.ddd.mill.infrastructure.persistent.domain;

import com.google.common.eventbus.EventBus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
abstract public class BaseAggregate {
    private transient EventBus eventBus;

    @Autowired
    public void setEventBus(EventBus eventBus) {
        this.eventBus = eventBus;
    }

    protected void apply(Object payload) {
        eventBus.post(payload);
    }
}
